<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="content-type" content="text/html; charset=gbk">
<script th:src="@{https://code.jquery.com/jquery-3.1.1.min.js}"></script>
</head>
<body>
  <div>
  	<div>
		Key: <input id="key" name="key" size=50 />
	</div>
	<div>
		ExtSchoolId: <input id="inputArea" name="inputArea" size=150 placeholder="..."/>
	</div>
	<button onclick="reSyncSchool()">test</button>
  </div>
  <div style="margin-top: 20px;">
  	<label>结果--------------------------------------------------</label>
  	<div id="result"></div>
  </div>
	
</body>

<script type="text/javascript">

		function reSyncSchool() {
			if ($('#key').val() == '') {
				alert('key 不能为空');
				return;
			}
			if ($('#inputArea').val() == '') {
				alert('Schoolid 不能为空');
				return;
			}

			//data就是json对象了，不需要再转换
			$.ajax({
				type : "post",
				url : "/sb/test/sync?clientId=" + $('#key').val()
						+ "&schoolExtIds=" + $("#inputArea").val(),
				contentType : "application/json;charset=utf-8",
				async : false,
				success : function(data) {
					$("#result").html(JSON.stringify(data));
				},
				error : function(XMLHttpRequest, textStatus, errorThrown) {
					alert(XMLHttpRequest.status);
				}
			});
		}
	</script>
	
</html>